﻿using System;
using System.Collections.Generic;
using System.Web;
using Castle.ActiveRecord.Framework.Config;
using System.Reflection;
using Castle.ActiveRecord;

/// <summary>
/// Summary description for initActiveRecord
/// </summary>
public static class ActiveRecord
{

    public static void initActiveRecord()
    {

        XmlConfigurationSource config = new XmlConfigurationSource(AppDomain.CurrentDomain.BaseDirectory.ToString() + "ARConfig.xml");

        // Se crea la instancia de configuracion
        //IConfigurationSource config = ActiveRecordSectionHandler.Instance;

        // Se inicializa el framework
        //ActiveRecordStarter.Initialize(config,typeof(Gos.Usuarios.User));

        /*Assembly asm = Assembly.Load("Gos.Usuarios");
        ActiveRecordStarter.Initialize(asm, config);
        */
        Assembly asm1 = Assembly.Load("Gos.Events");
        Assembly asm2 = Assembly.Load("Schooll.Model");

        ActiveRecordStarter.Initialize(new Assembly[] { asm1, asm2 }, config);

        // Se elimna el esquema de la base de datos
        //ActiveRecordStarter.DropSchema();

        // Se crea el equema en la base de datos
        //ActiveRecordStarter.CreateSchema();
        ActiveRecordStarter.GenerateCreationScripts(@"d:\script.txt");
        //ActiveRecordStarter.CreateSchema(typeof(Cajas.Model.Empresas));

        Gos.Events.Events.Registrer("Inicio", "inicialliza","SIN");





    }

}
